---
id: number
title: Number Node
sidebar_label: Number
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

![Number Node Screenshot](./assets/number-node.png)

## Overview

The Number Node is used to output a constant number value or convert an input value into a number. It can also be configured to round the number to a certain number of decimal places.

<Tabs
  defaultValue="inputs"
  values={[
    {label: 'Inputs', value: 'inputs'},
    {label: 'Outputs', value: 'outputs'},
    {label: 'Editor Settings', value: 'settings'},
  ]
}>

<TabItem value="inputs">

## Inputs

| Title | Data Type | Description                              | Default Value | Notes                                                                                                |
| ----- | --------- | ---------------------------------------- | ------------- | ---------------------------------------------------------------------------------------------------- |
| Input | `any`     | The value to be converted into a number. | (empty)       | This input is only available if `Use Value Input` is enabled. The input will be coerced to a number. |

</TabItem>

<TabItem value="outputs">

## Outputs

| Title | Data Type | Description                                                                              | Notes |
| ----- | --------- | ---------------------------------------------------------------------------------------- | ----- |
| Value | `number`  | The output number value. This can either be a constant value or a converted input value. | None  |

</TabItem>

<TabItem value="settings">

## Editor Settings

| Setting  | Description                                                                    | Default Value | Use Input Toggle | Input Data Type |
| -------- | ------------------------------------------------------------------------------ | ------------- | ---------------- | --------------- |
| Value    | The constant number value to be outputted.                                     | `0`           | Yes              | `number`        |
| Round    | If enabled, the output number will be rounded to the specified decimal places. | `false`       | No               | N/A             |
| Round To | The number of decimal places to round the output number to.                    | `0`           | No               | N/A             |

</TabItem>

</Tabs>

## Example 1: Output a constant number

1. Create a Number Node.
2. Set the `Value` to `123.456`.
3. Run the graph. The `Value` output of the Number Node should be `123.456`.

![Number Node Example 1](./assets/number-node-example-01.png)

## Example 2: Convert a string to a number

1. Create a Text Node and set the text to `123.456`.
2. Create a Number Node and enable the `Use Value Input` setting.
3. Connect the Text Node to the `Input` of the Number Node.
4. Run the graph. The `Value` output of the Number Node should be `123.456`.

![Number Node Example 2](./assets/number-node-example-02.png)

## Example 3: Round a number

1. Create a Number Node.
2. Set the `Value` to `123.456`.
3. Enable the `Round` setting and set `Round To` to `2`.
4. Run the graph. The `Value` output of the Number Node should be `123.46`.

![Number Node Example 3](./assets/number-node-example-03.png)

## Error Handling

The Number Node will not error under normal circumstances. If the `Input` value cannot be converted to a number, it will default to the `Value` setting.

## FAQ

**Q: Can I use the Number Node to convert a boolean to a number?**

A: Yes, you can use the Number Node to convert a boolean to a number. A `true` value will be converted to `1` and a `false` value will be converted to `0`.

**Q: What happens if I connect a non-numeric value to the `Input` of the Number Node?**

A: The Number Node will attempt to convert the input value to a number. If the conversion is not possible, the node will default to the `Value` setting.

**Q: Can I use the Number Node to round a number to an integer?**

A: Yes, you can use the Number Node to round a number to an integer by enabling the `Round` setting and setting `Round To` to `0`.

## See Also

- [Text Node](./text.mdx)
- [Bool Node](./bool.mdx)
- [Compare Node](./compare.mdx)
- [Evaluate Node](./evaluate.mdx)
- [RNG Node](./rng.mdx)
